<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ajax</title>
</head>
<body>
    <h1>最新电影</h1>
    <button>获取</button>
    <ul></ul>
    <script src="./ajax.js"></script>
    <script>
        document.querySelector('button').onclick=function(){
            let wd=this.value
            get('https://m.maizuo.com/gateway',`cityId=310100&pageNum=1&pageSize=10&type=1&k=3576785`,rs=>{
                let ulObj=document.querySelector('ul')
                ulObj.innerText=''
                if(!Array.isArray(rs.data.films)) return
                rs.data.films.forEach(item => {
                    let liObj = document.createElement('li')
                    liObj.innerHTML = `
                        ${item.filmId} - 
                        ${item.name}
                        <img src="${item.poster}" />
                    `
                    ulObj.appendChild(liObj)
                })
            },xhr=>{
                xhr.setRequestHeader('X-Client-Info', '{"a":"3000","ch":"1002","v":"5.0.4","e":"1640005088441707321622529","bc":"310100"}')
                xhr.setRequestHeader('X-Host', 'mall.film-ticket.film.list')
                xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
            })
        }
    </script>
</body>
</html>